package com.land.study.studyintentreceiver;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.widget.TextView;

public class IntentReceiverActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		SLog.d("IntentReceiverActivity onCreate");
		setContentView(R.layout.main_layout);
		TextView txtView = (TextView) findViewById(R.id.txt_intent_message);
		
		Intent intent = getIntent();
		
		if (intent != null) {
			String s = null;
			Parcelable vo = intent.getParcelableExtra("key");
			
			if (vo == null) {
				SLog.d("getting text from intent extra");
				s = intent.getStringExtra("key");
			} else {
				SLog.d("getting text from parcelable");
				s = vo.toString();
			}
			
			txtView.setText(s);
		}
	}
}